
package com.hd.sup.modules.vehicle.utils;

import com.google.common.collect.Lists;
import com.hd.common.constant.BizConstant;
import com.hd.common.utils.CollectionUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author chentl
 * @version V1.0
 * @Project 交通运输第三方监测平台
 * @Title VehicleUtils.java
 * @Description 车辆工具类
 * @Package com.hd.sup.modules.vehicle.utils
 * @date 2021/1/29 10:14 上午
 * @Copyright: 深圳市宏电技术股份有限公司 All rights reserved.
 */
@Slf4j
@Component
public class VehicleUtils {


    public static String getVehicleStatusCN(Integer vehicleStatus) {
        if (vehicleStatus == null) return "";
        //反显 定位状态、ACC状态
        List<String> statusList = Lists.newArrayList();

        boolean isAccOff = (vehicleStatus & 1) == 0;
        boolean isGpsOff = (vehicleStatus >> 1 & 1) == 0;

        //目前只需要反显 ACC 和 定位状态
        if (isAccOff) statusList.add("ACC 关");
        else statusList.add("ACC 开");

        if (isGpsOff) statusList.add("未定位");
        else statusList.add("已定位");


        return CollectionUtils.join(statusList, BizConstant.Common.SEPARATOR.key());
    }

}
